

def list2dict(list):
    ret = {}
    for i in list:
        for k in i:
            ret[k] = i[k]
    return ret

def dict2list(dict):
    ret = []
    for k in dict:
        tmp = {}
        tmp[k] = dict[k]
        ret.append(tmp)
    return ret

def translate_config_name_to_deployment_name(config_name=""):
    prefix = config_name.index('nginx-')
    la = config_name.index('-config')
    ret = config_name[prefix + 6: la]
    return ret